home *** CD-ROM | disk | FTP | other *** search
/ ShareWare OnLine 2 / ShareWare OnLine Volume 2 (CMS Software)(1993).iso / util2 / zipall11.zip / RESTZIP.BAT < prev    next >
DOS Batch File  |  1993-05-05  |  7KB  |  171 lines

  1. @echo off
  2. REM
  3. REM RESTZIP.BAT
  4. REM
  5. REM This batch file restores an UNZIPALLed ALLFILES.ZIP file as the
  6. REM only file in the current subdirectory.  
  7. REM
  8. REM If the file ZIPALL1.USD is present in the current subdirectory 
  9. REM (indicating that ZIPALL1.BAT was used to create the ALLFILES.ZIP --
  10. REM and thus ALLFILES.ZIP contains no files from children subdirectories),
  11. REM it will display all files within ONLY the current subdirectory that 
  12. REM have the Archive attribute, as an indication of whether any files were
  13. REM changed or added since UNZIPALL.BAT was executed. 
  14. REM 
  15. REM If the file ZIPALL1.USD is NOT present in the current subdirectory,
  16. REM (indicating that ZIPALL.BAT was used to create the ALLFILES.ZIP --
  17. REM and thus ALLFILES.ZIP DOES contain files from children subdirectories),
  18. REM it will display all files within the current subdirectory AND any 
  19. REM children subdirectories that have the Archive attribute, as an indication
  20. REM of whether any files were changed or added since UNZIPALL.BAT executed.
  21. REM
  22. REM
  23. REM After displaying files with the Archive attribute, the user must select:
  24. REM
  25. REM N -- No change   ALLFILES.ZIP will not be updated and the other files
  26. REM                  will be deleted, child subdirectories removed, if any.
  27. REM
  28. REM U -- Update      ALLFILES.ZIP file will be updated with changed or added
  29. REM                  files, in a move method that removes files and dirs.  
  30. REM
  31. REM X -- Exit        To exit RESTZIP.BAT with no action taken.
  32. REM
  33. REM
  34. REM This BAT file:
  35. REM   requires the use of the MS-DOS 5.0 (+) ATTRIB and DIR commands.
  36. REM   requires the use of Patri-Soft's PDEL.EXE (Shareware)
  37. REM   requires my WHICHWAY.EXE (Freeware)
  38. REM   requires my FEED.EXE (Freeware)
  39. REM
  40. cls
  41. if exist ALLFILES.ZIP goto continue
  42. echo.
  43. echo ALLFILES.ZIP does not exist in this subdirectory -- cannot be restored as
  44. echo the only file.  Use ZIPALL or ZIPALL1 to create a new ALLFILES.ZIP.
  45. goto exit
  46. :continue
  47. if not exist ZIPALL1.USD goto nowarn
  48. dir /aa /b | more
  49. echo.
  50. echo If any file names are listed above, they are files that were changed or added
  51. echo since you unzipped ALLFILES.ZIP with UNZIPALL.BAT.  You may want to Update
  52. echo ALLFILES.ZIP with the new versions of the changed files (and add any newly
  53. echo created files to it.)  Otherwise, you'll want to simply delete every file
  54. echo except ALLFILES.ZIP to leave it as it was before you ran UNZIPALL.BAT.
  55. echo Even if no files have changed, you can select Update to force the Archive
  56. echo attribute to be turned on for ALLFILES.ZIP, for backup purposes.
  57. echo Decide now, while viewing the list of files, above, before continuing.
  58. pause
  59. cls
  60. whichway X,U,N
  61. if errorlevel 255 goto abort
  62. if errorlevel 3 goto nochange
  63. if errorlevel 2 goto update
  64. if errorlevel 1 goto abort
  65. :nochange
  66. pdel allfiles.zip /o /wh /ba /eq /nt 
  67. if not exist allfiles.zip echo ALLFILES.ZIP blown somehow!! -- Unerase it now!
  68. REM *****************  USER MUST EDIT THE FOLLOWING LINE ********************* 
  69. REM *****************  TO INDICATE WHERE ZIPALL1.USD IS !!!  *****************
  70. copy c:\pkware\zipall1.usd 
  71. if not exist zipall1.usd goto usdexit
  72. attrib -a zipall1.usd
  73. attrib -a allfiles.zip
  74. prompt $P$G
  75. dir
  76. echo.
  77. echo ALLFILES.ZIP has been successfully restored, all other files deleted.
  78. echo The Archive bit for ALLFILES.ZIP has been reset (off).
  79. echo ZIPALL1.BAT was used to create ALLFILES.ZIP for this directory only.
  80. echo If this directory has subdirectories, DO NOT DELETE their contents!
  81. goto exit
  82. :update
  83. if exist zipall1.usd del zipall1.usd
  84. pkzip allfiles.zip *.* -mu -whs -Jhrs -ex
  85. if errorlevel 1 goto errexit1
  86. attrib +a allfiles.zip
  87. REM *****************  USER MUST EDIT THE FOLLOWING LINE ********************* 
  88. REM *****************  TO INDICATE WHERE ZIPALL1.USD IS !!!  *****************
  89. copy c:\pkware\zipall1.usd
  90. if not exist zipall1.usd goto usdexit
  91. attrib -a zipall1.usd
  92. prompt $P$G
  93. dir
  94. echo.
  95. echo ALLFILES.ZIP has been updated with changed (and/or new) files.
  96. echo All other files have been deleted (except Read-only files.)
  97. echo.
  98. echo ZIPALL1.BAT was used to create ALLFILES.ZIP from this directory only.
  99. echo If this directory has subdirectories, DO NOT DELETE their contents!
  100. echo.
  101. goto exit
  102. :nowarn
  103. dir /aa /b /s | more
  104. echo.
  105. echo If any file names are listed above, they are files that were changed or added
  106. echo since you unzipped ALLFILES.ZIP with UNZIPALL.BAT.  You may want to Update
  107. echo ALLFILES.ZIP with the new versions of the changed files (and add any newly
  108. echo created files to it.)  Otherwise, you'll want to simply delete every file
  109. echo except ALLFILES.ZIP to leave it as it was before you ran UNZIPALL.BAT.
  110. echo Even if no files have changed, you can select Update to force the Archive
  111. echo attribute to be turned on for ALLFILES.ZIP, for backup purposes.
  112. echo Decide now, while viewing the list of files, above, before continuing.
  113. pause
  114. cls
  115. whichway X,U,N
  116. if errorlevel 255 goto abort
  117. if errorlevel 3 goto nochang2
  118. if errorlevel 2 goto update2
  119. if errorlevel 1 goto abort
  120. :nochang2
  121. pdel allfiles.zip /o /eq /ba /wh /nt 
  122. dir /ad /b | feed eatdir.bat
  123. if not exist allfiles.zip echo ALLFILES.ZIP blown ! -- Unerase now!!
  124. attrib -a allfiles.zip
  125. prompt $P$G
  126. dir
  127. echo.
  128. echo ALLFILES.ZIP has been successfully restored, all other files deleted.
  129. echo Child subdirectories, if any, have also been removed.
  130. echo ZIPALL.BAT was used to create ALLFILES.ZIP from this dir and any children dirs.
  131. goto exit
  132. :update2
  133. pkzip allfiles.zip *.* -mu -whs -Jhrs -ex -rp
  134. if errorlevel 1 goto errexit1 
  135. pdel allfiles.zip /o /eq /ba /wh /nt  
  136. dir /ad /b | feed eatdir.bat
  137. attrib +a allfiles.zip
  138. prompt $P$G
  139. dir
  140. echo.
  141. echo ALLFILES.ZIP has been updated with changed (and/or new) files.
  142. echo All other files have been deleted.
  143. echo Child subdirectories, if any, have also been removed.
  144. echo ZIPALL.BAT was used to create ALLFILES.ZIP from this dir and any children dirs.
  145. echo.
  146. echo RUN YOUR BACKUPS BEFORE UNZIPPING THIS ALLFILES AGAIN -- ARCHIVE BIT IS ON!
  147. echo.
  148. goto exit
  149. :errexit1
  150. echo Error in execution of PKZIP.EXE (in RESTZIP.BAT).
  151. echo ALLFILES.ZIP may not have been updated - Read messages above, generated 
  152. echo by PKZIP, and do a DIR to see what's in the current directory before
  153. echo proceeding.
  154. goto exit
  155. :usdexit
  156. echo Error in execution of RESTZIP.BAT.
  157. echo DID YOU READ THE INSTALLATION INSTRUCTIONS?
  158. echo You must edit two lines in RESTZIP.BAT and one line in ZIPALL1.BAT to 
  159. echo change the hardcoded location of ZIPALL1.USD from "c:\pkware" to 
  160. echo wherever you decided to install these batch files (and ZIPALL1.USD).
  161. echo Just locate the string "c:\pkware" and edit appropriately.
  162. pause
  163. goto exit
  164. :abort
  165. dir
  166. echo.
  167. echo RESTZIP aborted at point of decision.  No action taken.
  168. goto exit
  169. :exit
  170. echo on
  171.